package com.shenmazong.user.controller;

import com.shenmazong.user.utils.FastFileUtil;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

/**
 * @author 军哥
 * @version 1.0
 * @description: FastDFS文件上传接口
 * @date 2022/6/24 20:31
 */

@Api(tags = "FastDFS文件上传")
@RestController
@Slf4j
@RequestMapping(value = "/fast")
public class FastDfsController {

    @Autowired
    FastFileUtil fastFileUtil;

    @PostMapping(value = "/upload")
    public String upload(@RequestParam("file") MultipartFile multipartFile) throws IOException {

        String url = fastFileUtil.uploadFile(multipartFile);
        log.warn(url);
        return url;
    }

}
